package com.shelpe.services.simbasync.service;

import java.io.IOException;
import java.util.Date;
import java.util.List;
import java.util.Map;

import com.shelpe.services.simbasync.model.InsightKeywordData;
import com.shelpe.services.simbasync.model.Keywords;
import com.shelpe.services.simbasync.model.RptKeyword;
import com.shelpe.services.simbasync.model.mongo.KeywordStrTemp;
import com.shelpe.services.simbasync.model.mongo.WordInsightMetric;
import com.shelpe.services.simbasync.service.simbaproxy.KeywordsProxy.Score;

public interface KeywordsService {
	
	public int addKeywords(String userId, Keywords keywords);
	
	public int addKeywordsList(String userId, List<Keywords> keywords);
	
	public int setKeywordsPrice(String userId, List<Keywords> keywords);
	
	public int addRptKeywords(String userId, RptKeyword rpt);
	
	public int deleteRptKeywordsByDateRange(String userId, List<Long> adgroupIds, Date startDate, Date endDate);
	
	public int addRptKeywordsList(String userId, List<RptKeyword> rptList);
	
	public int insertKeywordsBatch(String userId, List<Keywords> list);
	
	public int insertRptKeywordsBatch(String userId, List<RptKeyword> rptList);
	
	public List<Keywords> getKeywordsByAdGroupId(String userId, Long adgroupId);
	
	public List<Keywords> getKeywordsByUserId(String userId);
	
	public List<Keywords> getKeywordsByWirelessQscore(String userId, Long adgroupId);
	
	public List<String> getWordByUserId(String userId);
	
	public int deleteKeywords(String userId, Keywords ad);
	
	public int deleteKeywordsList(String userId, List<Keywords> adList);
	
	public int updateKeywords(String userId, Keywords ad);
	
	public int updateKeywordsList(String userId, List<Keywords> adList);

	public Date getLastTimeFromRpt(String userId, long campaignId, long adgroupId);
	
	public Date getLastTimeFromRptScore(String userId, long adgroupId);
	
	public List<Keywords> parseJsonToKeywords(String response);
	
	public void updateKeywordsData(String userId, List<Keywords> list);
	
	public Map<String, List<Keywords> > splitKeywords(List<Keywords> newList, List<Keywords> oldList);
	
	public List<Keywords> getKeywordIdsScore(String nick, Long adgroupId, List<Keywords> keywords, List<Score> scoreList);

	public List<RptKeyword> parseJsonToRptKeywordBase(String response);
	
	public int combineRptKeywordEffect(String response, Map<String, Integer> lastDayRecord, List<RptKeyword> list);
	
	public void updateRptKeywordData(String userId, List<RptKeyword> list);
	
	public int deleteRptKeywordByUserIdDate(String userId, Date date);
	
	public int insertRptKeywordScore(String userId, List<Score> scoreList);
	
	public boolean getRemoteFile(String strUrl, String fileName) throws IOException;
	
	public boolean existKeywordsTable(String userId);
    
	public int createKeywordsTable(String userId);
	
	public int alterKeywordsTable(String userId);

	public boolean existRptKeywordsTable(String userId);
    
	public int createRptKeywordsTable(String userId);
	
	public int alterRptKeywordsTable(String userId);
	
	public Date getLastDateByWord(String keywordStr);
	
	public List<InsightKeywordData> getAndParseLInsightKeywordData(long userId, String date, List<String> words);
	
	public List<WordInsightMetric> getInsightWordData(Long userId, String startDate, String endDate, List<String> words);
	
	public int insertInsightKeywordDataBatch(List<InsightKeywordData> list);
	
	public boolean saveInsightWordData(List<WordInsightMetric> list);
	
	public boolean existsByWordAndScopeEndTime(String word, Date endTime);
	
	public boolean deleteByScopeEndTime(Date endTime);
	
	public boolean existsKeywordStrTempByWord(String word);
	
	public KeywordStrTemp getKeywordStrTempByWord(String word);
	
	public boolean saveKeywordStrTempList(List<KeywordStrTemp> list);

}